package com.youhong.teethcare

import android.os.Bundle
import android.support.v7.widget.LinearLayoutManager
import com.youhong.teethcare.adapter.BrushingStepAdapter
import com.youhong.teethcare.utils.Util
import kotlinx.android.synthetic.main.activity_brushing_steps.*


class BrushingStepsActivity : BaseActivity() {
    companion object{
        const val keyInfo="keyInfo";
        const val infoType_BrushingSteps=1;
        const val infoType_Instructions=0;
    }
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_brushing_steps)
        initStatusBar(resources.getColor(R.color.pageBackground), true)
        init();
    }
   fun init(){
       aboutUs_iv_back.setOnClickListener { finish() }
       var infoType= intent.getIntExtra(keyInfo,infoType_Instructions)
       var  title=when(infoType){
           infoType_Instructions->resources.getString(R.string.instructions)
           else->resources.getString(R.string.brushing_steps)
       }
       tvTitleBrushingSteps.text=title;
       var  tips=when(infoType){
           infoType_Instructions->getString(R.string.instructionTipS)
           else->getString(R.string.brushingStepTips)
       }
       tvBrushingStepTips.text=tips;
       var srcList=when(infoType){
           infoType_Instructions->Util.getResourcesImageArray(this,R.array.instructionsSrcs)
           else->Util.getResourcesImageArray(this,R.array.brushingStepSrcs)
       }
       var titleList=when(infoType){
           infoType_Instructions->resources.getStringArray(R.array.instructions_titles)
           else->resources.getStringArray(R.array.brushingStep_titles)
       }
        var adapter=BrushingStepAdapter(titleList,
                srcList,infoType==infoType_Instructions)
       var manager=LinearLayoutManager(this)
       manager.orientation=LinearLayoutManager.VERTICAL;
       RecyclerView_brushingStep.adapter=adapter;
       RecyclerView_brushingStep.layoutManager=manager;

    }
}